<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <!-- <meta name="viewport" content="width=device-width, initial-scale=1.0" /> -->
    <title>Document</title>
  </head>
  <body>
    <div id="box"></div>
    <div id="box1"></div>
    <script>
      setInterval(() => {
        // 布局视口
        document.querySelector('#box').innerText =
          document.documentElement.clientWidth

        // 视觉视口
        document.querySelector('#box1').innerText = window.innerWidth
      }, 50)
    </script>
  </body>
</html>
